import { NgxMonacoEditorConfig } from "ngx-monaco-editor";
import { PL00TokensProvider } from "../interpreter/PL00TokensProvider";
const monacoConfig: NgxMonacoEditorConfig = {
  baseUrl: "assets",
  defaultOptions: { scrollBeyondLastLine: false },
  onMonacoLoad: () => {
    monaco.languages.register({ id: "pl00" });
    monaco.languages.setTokensProvider("pl00", new PL00TokensProvider());
    let literalFg = "3b8737";
    let idFg = "344482";
    let symbolsFg = "000000";
    let keywordFg = "0c00ed";
    let numberFg = "ff944d";
    let errorFg = "ff0000";
    let commentFg = "3b8737";
    let bracketFg = "4db8ff";
    let operatorFg = "9933ff";
    monaco.editor.defineTheme("pl00-white", {
      base: "vs",
      inherit: false,
      colors: {},
      rules: [
        { token: "identifier.pl00", foreground: idFg, fontStyle: "italic" },
        { token: "string.pl00", foreground: literalFg },
        { token: "integer.pl00", foreground: numberFg },
        { token: "break.pl00", foreground: keywordFg },
        { token: "continue.pl00", foreground: keywordFg },
        { token: "const.pl00", foreground: keywordFg },
        { token: "linecomment.pl00", foreground: commentFg },
        { token: "begin.pl00", foreground: keywordFg },
        { token: "end.pl00", foreground: keywordFg },
        { token: "var.pl00", foreground: keywordFg },
        { token: "procedure.pl00", foreground: keywordFg },
        { token: "function.pl00", foreground: keywordFg },
        { token: "call.pl00", foreground: keywordFg },
        { token: "return.pl00", foreground: keywordFg },
        { token: "if.pl00", foreground: keywordFg },
        { token: "then.pl00", foreground: keywordFg },
        { token: "else.pl00", foreground: keywordFg },
        { token: "while.pl00", foreground: keywordFg },
        { token: "do.pl00", foreground: keywordFg },
        { token: "import.pl00", foreground: keywordFg },
        { token: "lbracket.pl00", foreground: bracketFg },
        { token: "rbracket.pl00", foreground: bracketFg },
        { token: "lparen.pl00", foreground: bracketFg },
        { token: "rparen.pl00", foreground: bracketFg },
        { token: "equal.pl00", foreground: operatorFg },
        { token: "plus.pl00", foreground: operatorFg },
        { token: "minus.pl00", foreground: operatorFg },
        { token: "mul.pl00", foreground: operatorFg },
        { token: "div.pl00", foreground: operatorFg },
        { token: "becomes.pl00", foreground: operatorFg },
        { token: "lt.pl00", foreground: operatorFg },
        { token: "gt.pl00", foreground: operatorFg },
        { token: "ge.pl00", foreground: operatorFg },
        { token: "notequal.pl00", foreground: operatorFg },
        { token: "dot.pl00", foreground: operatorFg },
        { token: "unrecognized.pl00", foreground: errorFg },
      ],
    });
  },
};
export default monacoConfig;
